#include <iostream>
#include <unistd.h>
#include <gtest/gtest.h>
#include <libgo/coroutine.h>


#define O(x) std::cout << x << std::endl

namespace mutex {
    static co_mutex g_mutex;

    void f2() {
        g_mutex.unlock();
        O(1);
    }

    void f1() {
        go f2;
        g_mutex.lock();
        O(2);
    }
}

TEST(mutex, test) {
    using namespace mutex;

    g_mutex.try_lock();
    go f1;

    co_sched.Start();
}
